<!DOCTYPE html>
<html>
<head>
    <title>我的合同详情</title>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="description"
          content="Write an awesome description for your new site here. You can edit this line in _config.yml. It will appear in your document head meta (for Google search results) and in your feed.xml site description.10 ">
    <link rel="stylesheet" href="https://cdn.bootcss.com/weui/1.1.2/style/weui.min.css">
    <link rel="stylesheet" href="https://cdn.bootcss.com/jquery-weui/1.2.0/css/jquery-weui.min.css">
    <!-- Swiper容器-->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/Swiper/4.0.2/css/swiper.css">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/Swiper/4.0.2/css/swiper.min.css">
    <link rel="stylesheet" href="/static/weixin/css/style.css">
    <!-- body 最后 -->
    <script src="https://cdn.bootcss.com/jquery/1.11.0/jquery.min.js"></script>
    <script src="https://cdn.bootcss.com/jquery-weui/1.2.0/js/jquery-weui.min.js"></script>
    <!-- 如果使用了某些拓展插件还需要额外的JS -->
    <script src="https://cdn.bootcss.com/jquery-weui/1.2.0/js/swiper.min.js"></script>
    <script src="https://cdn.bootcss.com/jquery-weui/1.2.0/js/city-picker.min.js"></script>
    <script src="/static/js/utils.js"></script>
    <!-- Swiper的容器-->
    <script src="https://cdnjs.cloudflare.com/ajax/libs/Swiper/4.0.2/js/swiper.js"></script>

    <script src="https://cdnjs.cloudflare.com/ajax/libs/Swiper/4.0.2/js/swiper.min.js"></script>
    <!-- style -->

    <style>
        p {
            font-size: 12px
        }

        div {
            font-size: 12px
        }

        body {

            color: Black

        }

        .weui-cell__ft {

            color: black

        }

        .weui-form-preview__label {

            color: black

        }

        .weui-form-preview__value {

            color: black
        }

        .weui-input {
            color: black
        }

        .my-zfsq {
            text-align: left
        }

        .my-dzls {
            margin-right: 12%;
            margin-left: 13%;
        }

        .my-lable {
            margin-right: 23%;
        }

        .my-dzls {
            margin-right: 23%;
        }
    </style>
</head>
<body>
<div class="wy-Module">
    <div class="wy-Module-con">
        <div class="weui-cells" style="
    margin-top: 0px;
">
            <div class="weui-cell">
                <div class="weui-cell__bd">
                    <p id="htbh"></p>
                </div>
                <div class="weui-cell__ft my-zs" style="color:black"><p id="my-zs"></p></div>
            </div>
            <div class="weui-cell__ft" style="padding-right:4%;color:black"><p id="my-qdrq"></p></div>
        </div>
        <div class="weui-cells" style="
    margin-top: 0px;
">
            <div class="weui-cell">
                <div class="weui-cell__bd">
                    <p id="my-zhxx"></p>
                </div>
                <div class="weui-cell__ft" style="color:black"><p id="my-fjmj"></p></div>
            </div>
            <div class="weui-cell__ft" style="padding-right:4%;color:black"><p id="my-sjmj"></p></div>
        </div>
        <div class="weui-form-preview">
            <div class="weui-form-preview__bd">
                <div class="weui-form-preview__item">
                    <label class="weui-form-preview__label my-lable"><p id="my-xm"></p></label>
                    <!--  <label class="weui-form-preview__label" style=" margin-right: 0px;">别名：电玩城</label> -->
                    <span class="weui-form-preview__value"><p id="my-bm"></p></span>
                </div>
                <div class="weui-form-preview__item">
                    <label class="weui-form-preview__label my-lable"><p id="my-sshy"></p></label>
                    <!-- <label class="weui-form-preview__label" style=" margin-right: 0px;">身份证号：411002199205062055</label> -->
                    <span class="weui-form-preview__value"><p id="my-sfzh"></p></span>
                </div>
                <div class="weui-form-preview__item">
                    <label class="weui-form-preview__label my-lable"><p id="my-qdr"></p></label>
                    <!-- <label class="weui-form-preview__label" style=" margin-right: 0px;">姓名：华生辉</label> -->
                    <!--<span class="weui-form-preview__value">姓名：华生辉</span>-->
                </div>
                <div class="weui-form-preview__label">通讯地址：</div>
                <div class="weui-cell__bd">
                    <input id="my-txdz" class="weui-input" type="text" placeholder="">
                </div>
            </div>
        </div>
    </div>

    <div class="weui-form-preview">
        <div class="weui-form-preview__bd">
            <div class="weui-form-preview__item">
                <label class="weui-form-preview__label my-lable"><p id="my-zpqx"></p></label>
            </div>

            <div class="weui-form-preview__item">
                <label class="weui-form-preview__label my-lable"><p id="my-zjdj"></p></label>
            </div>

            <div class="weui-form-preview__item">
                <label class="weui-form-preview__label my-lable"><p id="my-fwyj"></p></label>
            </div>

            <div class="weui-form-preview__item">
                <label class="weui-form-preview__label my-lable"><p id="my-fkzq"></p></label>
                <span class="weui-form-preview__value"><p id="my-fkr"></p></span>
            </div>

            <div class="weui-form-preview__item">
                <label class="weui-form-preview__label my-lable">递增/折扣：</label>
            </div>

            <div class="weui-form-preview__item">
                <label class="weui-form-preview__label my-lable"><p id="my-dzfs"></p></label>
            </div>

            <div class="weui-form-preview__item">
                <label class="weui-form-preview__label my-lable"><p id="my-znj"></p></label>
            </div>

            <div class="weui-form-preview__item">
                <label class="weui-form-preview__label my-dzls"><p id="my-dzl"></p></label>
            </div>
        </div>
        <div class="weui-form-preview">
            <div class="weui-form-preview__bd">
                <div class="weui-form-preview__item my-zfsq">
                    <div class="my-zfsq">
                    </div>
                </div>
            </div>
            <div class="weui-form-preview">
                <div class="weui-form-preview__bd">
                    <div class="weui-form-preview__label">附件：</div>
                    <div class="weui-cell__bd">
                        <input class="weui-input" type="text" placeholder="">
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
<script>
    //初始化合同详情
    var con_id = "${ID}";
    //var con_id = "1fa29152cfa544f6a5db332f3b64a781";
    $(function () {
        $.ajax({
            url: "/WeixinConController/con_all",
            data: {id: con_id},
            dataType: "json",
            async: false,
            success: function (res) {
                var contract = res.data.contract;
                var room = res.data.room;
                var discount = res.data.discount;//滞纳金
                var contractLateFee = contract.LATE_FEE;
                var property = res.data.property;//杂费收费（水费电费。。。）
                var initRead = res.data.initRead;//初始读数
                $("#htbh").html("合同编号：" + contract.CONTRACT_NUM);
                $("#my-zs").html("招商：" + contract.SUBMIT_PERSON_NAME);
                $("#my-qdrq").html("签订日期：" + contract.CON_DATE);
                for (var i = 0; i < room.length; i++) {
                    $("#my-zhxx").html(room[i].BUSINESS_NAME + "商圈" + room[i].BUILDING_NAME + "号楼" + room[i].ROOM_NUM + "房间");
                    $("#my-fjmj").html(room[i].ROOM_AREA + "㎡");
                }
                $("#my-sjmj").html("实际租用面积：" + contract.AREA + "㎡");
                $("#my-xm").html("姓名：" + contract.SIGNER);
                $("#my-bm").html("别名：" + contract.BYNAME);
                $("#my-sshy").html("所属行业：" + contract.INDUSTRY_NAME);
                if (contract.LEASE == 0) {
                    $(".legal_person_name").html(contract.LEGAL_PERSON_NAME);
                    $(".legal_person_tel").html(contract.LEGAL_PERSON_TEL);
                } else if (contract.LEASE == 1) {
                    $(".company_name_type").html("姓名：");
                    $(".business_license_type").html("身份证号：");
                    $(".legal_person").remove();
                }
                $("#my-sfzh").html("身份证号：" + contract.BUSINESS_LICENSE);
                $("#my-qdr").html("签订人：" + contract.SIGNER);
                $("#my-txdz").html(contract.CONTRACT_ADDRESS);
                $("#my-zpqx").html("租赁期限：" + contract.CON_HR_DATE + "至" + contract.CON_END_DATE);
                $("#my-zjdj").html("租金单价：" + contract.RENT + "元/年");
                $("#my-fwyj").html("房屋押金：" + contract.BOND);
                $("#my-fkzq").html("付款周期：" + contract.PAYMENT_PERIOD);
                $("#my-fkr").html("付款日：提前" + contract.ANT_PAY_DAY + "天付款");
                if (contract.INCREAS_RATE == 0) {
                    $("#my-dzfs").html("递增方式：原始租金递增");
                } else if (contract.INCREAS_RATE == 1) {
                    $("#my-dzfs").html("递增方式：上年租金递增");
                }
                if (!contractLateFee || contractLateFee == " - ") {
                    contractLateFee = 0;
                }
                $("#my-znj").html("滞纳金：年租金的" + contractLateFee + "%");
                // $(".discounts").empty();
                if (!!discount) {
                    for (var i = 0; i < discount.length; i++) {
                        var znj = discount[i].LATE_FEE;
                        if (!znj) {
                            znj = "0.00";
                        }
                        var str = '<div >\n' +
                            '          <span>第' + discount[i].FIRST_YEAR + '年：' +
                            '递增率：' + discount[i].INCREAS_RATE + '%；' +
                            '折扣：' + discount[i].DISCOUNT + '折；' +
                            '折后价格：' + discount[i].DISCOUNT_RENT + '；' +
                            '滞纳金：' + znj + '元/天。</span>\n' +
                            '      </div>';
                        $("#my-dzl").append(str);
                    }
                }
                //$(".property-info").empty();
                if (!!property) {
                    for (var i = 0; i < property.length; i++) {
                        var sffs = '';
                        var initReadStr = "";
                        if (property[i].CHARGE_TYPE == 0) {
                            sffs = '固定价格';
                        } else if (property[i].CHARGE_TYPE == 1) {
                            sffs = '抄表收费';
                            if (property[i].PROPERTY_TYPE_ID == 'a14e6f2e190e4492badac72e9b42152e' || property[i].PROPERTY_TYPE_ID == 'ddcf9b35bbe04cd88834e21c1fd74f32') {
                                if (!!initRead) {
                                    initReadStr += '<div class="">\n' +
                                        '                                    <div class="">\n' +
                                        '                                        初始读数：\n' +
                                        '                                    </div>\n' +
                                        '                                    <div class="">\n';
                                    for (var j = 0; j < initRead.length; j++) {
                                        if (property[i].PROPERTY_TYPE_ID == initRead[j].PROPERTY_TYPE_ID) {
                                            initReadStr += '<div class="" style="width: auto;">\n' +
                                                '               <span>' + initRead[j].CODE + ' 读数：' + initRead[j].INIT_READ + ' 日期：' + initRead[j].INIT_READ_TIME + '</span>\n' +
                                                '           </div><br>';
                                        }
                                    }
                                    initReadStr += '                    </div>\n' +
                                        '                                </div>';
                                }
                            }
                        } else if (property[i].CHARGE_TYPE == 2) {
                            sffs = '按面积收费';
                        } else if (property[i].CHARGE_TYPE == 3) {
                            sffs = '即时收费';
                            if (property[i].PROPERTY_TYPE_ID == 'a14e6f2e190e4492badac72e9b42152e' || property[i].PROPERTY_TYPE_ID == 'ddcf9b35bbe04cd88834e21c1fd74f32') {
                                if (!!initRead) {
                                    initReadStr += '<div class="">\n' +
                                        '                                    <div class="">\n' +
                                        '                                        初始读数：\n' +
                                        '                                    </div>\n' +
                                        '                                    <div class="">\n';
                                    for (var j = 0; j < initRead.length; j++) {
                                        if (property[i].PROPERTY_TYPE_ID == initRead[j].PROPERTY_TYPE_ID) {
                                            initReadStr += '<div class="" style="width: auto;">\n' +
                                                '               <span>' + initRead[j].CODE + ' 读数：' + initRead[j].INIT_READ + ' 日期：' + initRead[j].INIT_READ_TIME + '</span>\n' +
                                                '           </div><br>';
                                        }
                                    }
                                    initReadStr += '                    </div>\n' +
                                        '                                </div>';
                                }
                            }
                        }
                        var dw = '';
                        if (property[i].PROPERTY_TYPE_ID == 'a14e6f2e190e4492badac72e9b42152e') {
                            if (property[i].CHARGE_TYPE == 1) {
                                dw = '元/吨';
                            } else {
                                dw = '元/月';
                            }
                        } else if (property[i].PROPERTY_TYPE_ID == 'ddcf9b35bbe04cd88834e21c1fd74f32') {
                            if (property[i].CHARGE_TYPE == 1) {
                                dw = '元/度';
                            } else {
                                dw = '元/月';
                            }
                        } else if (property[i].PROPERTY_TYPE_ID == '669791dac4894160bc8d79b484519e96' || property[i].PROPERTY_TYPE_ID == '7b05982a081e41deb9b46a1f6f5ed5fa') {
                            if (property[i].DEFAULT_ID == "-1") {
                                dw = '元/年';
                            } else {
                                dw = '元/㎡·天';
                            }
                        } else {
                            if (property[i].CHARGE_TYPE == 0) {
                                dw = '元/月';
                            } else if (property[i].CHARGE_TYPE == 2) {
                                dw = '元/㎡·天';
                            }
                        }

                        var jg = property[i].CHARGE_PRICE;
                        if (!jg) {
                            jg = 0;
                        }
                        if (property[i].IS_DEFAULT == 0) {
                            jg = jg + dw;
                        } else if (property[i].IS_DEFAULT == 1) {
                            jg = property[i].DEFAULT_PRICE + dw;
                        }
                        var sfrq = '';
                        if (property[i].CHARGE_DATE_TYPE == 0) {
                            sfrq = '提前' + property[i].CHARGE_DATE + '天';
                        } else if (property[i].CHARGE_DATE_TYPE == 1) {
                            sfrq = '固定' + property[i].CHARGE_DATE + '号';
                        } else if (property[i].CHARGE_DATE_TYPE == 2) {
                            sfrq = '抄表后' + property[i].CHARGE_DATE + '天';
                        }
                        var sffsStr = '';
                        var fkzqStr = property[i].PAY_DATE;
                        if (property[i].PROPERTY_TYPE_ID == '669791dac4894160bc8d79b484519e96' || property[i].PROPERTY_TYPE_ID == '7b05982a081e41deb9b46a1f6f5ed5fa') {
                            fkzqStr = property[i].DATE_START_MONTH + "月" + property[i].DATE_START_DAY + "日 至 " + property[i].DATE_END_MONTH + "月" + property[i].DATE_END_DAY + "日";
                        } else {
                            fkzqStr += "月";
                            sffsStr += '     <div class="">\n' +
                                '                   <div class="">\n' +
                                '                       收费方式：' + sffs + '\n' +
                                '                   </div>\n' +
                                '               </div>\n';
                        }
                        var info = property[i].INFO;
                        if (!info) {
                            info = "";
                        }
                        var str = '<fieldset class="">\n' +
                            '           <legend>' + property[i].CODE + '</legend>\n' +
                            '           <div class="">\n' +
                            '               <div class="">\n' +
                            '                   <div class="">\n' +
                            '                       发票占比：' + property[i].PROPERTY_FPZB + '%\n' +
                            '                   </div>\n' +
                            '               </div>\n' +
                            '               <div class="">\n' +
                            '                   <div class="">\n' +
                            '                       付款周期：' + fkzqStr + '\n' +
                            '                   </div>\n' +
                            '               </div>\n';
                        str += sffsStr;
                        str += initReadStr;
                        if (property[i].CHARGE_TYPE != "3") {
                            str += '               <div class="">\n' +
                                '                   <div class="">\n' +
                                '                       价格：' + jg + '\n' +
                                '                   </div>\n' +
                                '               </div>\n';
                        }
                        var pStr = "收费";
                        if (property[i].CHARGE_TYPE == "3") {
                            pStr = "提醒";
                        }
                        str += '               <div class="">\n' +
                            '                   <div class="">\n' +
                            '                       ' + pStr + '日期：' + sfrq + '\n' +
                            '                   </div>\n' +
                            '               </div>\n' +
                            '               <div class="">\n' +
                            '                   <div class="">\n' +
                            '                       备注：' + info + '\n' +
                            '                   </div>\n' +
                            '               </div>\n' +
                            '           </div>\n' +
                            '       </fieldset>';
                        $(".my-zfsq").append(str);
                    }
                }
            },
            error: function (XMLHttpRequest, textStatus, errorThrown) {
                console.error(XMLHttpRequest.status);
                console.error(XMLHttpRequest.readyState);
                console.error(textStatus);
            }
        });
    });
</script>
</html>